/*
 * tilesetLayer.hpp
 *
 *  Created on: Aug 9, 2013
 *      Author: jason
 */

#ifndef TILESETLAYER_HPP_
#define TILESETLAYER_HPP_

#include <tinyxml.h>
#include <string>
#include "tilesetTiles.hpp"

namespace Tmx {

class Tile;
class Map;
enum EncodingType { ENCODE_XML, ENCODE_BASE64, ENCODE_CSV };
enum CompressionType {COMPRESS_NONE, COMPRESS_ZLIB, COMPRESS_GZIP};

class Layer {
public:
	Layer(Map *map, int _depth);
	~Layer();
	void parse(TiXmlNode *layerNode);
	std::string getName() {return name;}
	int getWidth() {return width;}
	int getHeight() {return height;}
	int getDepth() {return depth;}
	float getOpacity() {return opacity;}
	bool getVisibility() {return visible;}
	bool isTileFlippedHorizontally(int x, int y) {return tile_map[y*width+x].flippedHoriz;}
	bool isTileFlippedVertically(int x, int y) {return tile_map[y*width+x].flippedVert;}
	bool isTileFlippedDiagally(int x, int y) {return tile_map[y*width+x].flippedDiag;}
	int getTileId(int x, int y) {return tile_map[y*width+x].id;}
private:
	void parseXML(TiXmlNode *dataNode);
	void parseB64() {}; // will implement if necessary
	int LayerEncodingType;
	int LayerCompressionType;
	std::string name;
	int width;
	int height;
	int depth; // TODO add this
	float opacity;
	bool visible;
	Map *pMap;
	Tiles *tile_map;
}; // class Layer

}; // namespace Tmx

#endif /* TILESETLAYER_HPP_ */
